# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=apkleaks
pkgver=v2.6.3.r2.gdd5271a
pkgrel=1
pkgdesc='Scanning APK file for URIs, endpoints & secrets.'
arch=('any')
groups=('blackarch' 'blackarch-mobile' 'blackarch-misc')
url='https://github.com/dwisiswant0/apkleaks'
license=('Apache')
depends=('python' 'pyaxmlparser' 'jadx')
makedepends=('git' 'python-build' 'python-pip')
source=("git+https://github.com/dwisiswant0/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd $pkgname

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd $pkgname

  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --ignore-installed \
    --no-compile \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    $pkgname

  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md VERSION
}

